#include <bits/stdc++.h>
using namespace std;
multiset<int> s;
int n,l,r;
char c;
int main() {
    freopen("stone.in","r",stdin);
    freopen("stone.out","w",stdout);
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin>>n;
    for (int i=1;i<=n;++i) {
        cin>>c>>l>>r;
        if (c=='A') s.insert(r-l);
        else s.erase(s.lower_bound(r-l));
        if (s.size()==1) cout<<*s.begin()<<'\n';
        else cout<<*s.begin()+*(++s.begin())<<'\n';
    }
}